package BackEnd;

public class Stock {
	int numShares;
	double totalCost;
	double salePrice;

	protected double GetCostPerStock() {
		return salePrice;
	}

	protected void setCostPerStock(double costPerStock) {
		this.salePrice = costPerStock;
	}

	protected Stock(int numShares, double costPerStock) {
		this.salePrice = costPerStock;
		this.numShares = numShares;
		this.totalCost = (numShares * salePrice);
	}

	protected int getNumShares() {
		return numShares;
	}

	protected double getTotalCost() {
		return totalCost;
	}

	protected double getPotentialSaleValue() {
		return (salePrice * numShares);
	}

	protected double getNetValue() {
		return totalCost - (salePrice * numShares);
	}

	protected void buyShares(int numShares) {
		this.numShares = this.numShares + numShares;
		totalCost = totalCost + (numShares * salePrice);
	}

	protected double sellShares(int numShares) {
		this.numShares = this.numShares - numShares;
		return (numShares * salePrice);
	}
	
	protected void clear() {

		numShares = 0;
		totalCost = 0;
		salePrice = 0;
	}

}
